package com.douyang.controller;

import cn.dev33.satoken.annotation.SaCheckRole;
import com.douyang.VO.SystemQuestionAnswerVO;
import com.douyang.base.model.PageResult;
import com.douyang.base.model.Result;
import com.douyang.dto.GetSystemAnswerDTO;
import com.douyang.dto.SystemQuestionAnswerDTO;
import com.douyang.service.SystemQuestionAnswerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xiaoma
 * @since 2025-03-10
 */
@RestController
@RequestMapping("/user/systemQuestionAnswer")
@SaCheckRole("admin")
public class SystemQuestionAnswerController {

    @Autowired
    private SystemQuestionAnswerService systemQuestionAnswerService;

    @PostMapping("/getAllSystemList")
    public Result<PageResult<SystemQuestionAnswerVO>> getAllSystemList(@RequestBody GetSystemAnswerDTO getSystemAnswerDTO) {
        return Result.success(systemQuestionAnswerService.getAllSystemList(getSystemAnswerDTO));
    }

    @PostMapping("/addSystemAnswer")
    public Result<String> addSystemAnswer(@RequestBody SystemQuestionAnswerDTO systemQuestionAnswerDTO) {
        systemQuestionAnswerService.addSystemAnswer(systemQuestionAnswerDTO);
        return Result.success("ok");
    }

    @DeleteMapping("/removeSystemAnswer")
    public Result<String> removeSystemAnswer(Long id) {
        systemQuestionAnswerService.removeById(id);
        return Result.success("ok");
    }
}
